Release 10.1A: OpenEdge Development:
ProDataSets
Using COPY-DATASET with a dynamic target ProDataSet
This first
COPY-DATASETexample shows how to copy a static source ProDataSet to a dynamic target, and have Progress create the structure of the target before copying into it. The sample procedure is calledDynCopy.p. It first includes the same static temp-table and ProDataSet definitions used elsewhere. It then defines variables to hold the handles of the target dynamic ProDataSet, its top-level buffer, and a dynamic query for that buffer, as shown:
The procedure next defines a static query for the
Ordertable, along with the Data-Sources the ProDataSet uses, as shown:
It then prepares the source ProDataSet query to retrieve
Orders forCustomer 1, along with theirOrderLinesandItems, and attaches the Data-Sources. TheFILLbrings all this data into the source ProDataSet, as shown:
A simple
DISPLAYloop confirms that theOrders are in the source ProDataSetdsOrderand itsttOrdertemp-table, as shown:
The procedure creates the dynamic ProDataSet using the handle
hDataSet2, as shown:
This is initially an empty structure for a ProDataSet. It has no table or relation definitions. The
COPY-DATASETmethod copies the table and Data-Relation structure fromdsOrderto the new dynamic ProDataSet, and then its data. To verify that both the definition and its data have been copied, the procedure creates a dynamic query for the top-level table in the new ProDataSet and prepares the query to navigate its rows. As explained above, theCOPY-DATASETmethod gives the new dynamic buffer the name “cpy_” plus the source buffer name, as shown:
The procedure opens the dynamic query and walks through all the rows at the top level of the target ProDataSet, displaying the same
OrderNumandCustNumfields to verify that it contains the same data as the source, as shown:
When you run the procedure it shows you the
Orders in both ProDataSets:
![]()
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |